import request from '@/utils/request'

// 统一前缀
var prefix = '/userService'

//查询所有路由
export function lookAllRouter() {
  return request({
    url: `${prefix}/router`,
    method: 'GET',
  })
}

// 条件查询路由
export function lookRouter(Router) {
  return request({
    url: `${prefix}/router/list`,
    method: 'GET',
    params: Router,
  })
}

// 添加一条路由
export function insertOneRouter(Router) {
  return request({
    url: `${prefix}/router`,
    method: 'POST',
    data: Router,
  })
}

// 修改路由
export function updateOneRouter(Router) {
  return request({
    url: `${prefix}/router`,
    method: 'PUT',
    data: Router,
  })
}

// 删除路由
export function deleteRouter(ids) {
  return request({
    url: `${prefix}/router`,
    method: 'DELETE',
    data: ids,
  })
}

// 根据权限ID查询对应路由列表
export function lookRouterByPermission(perId) {
  return request({
    url: `${prefix}/router/per`,
    method: 'GET',
    params: {permissionId: perId},
  })
}

// 绑定权限到路由
export function bindPermission(map) {
  return request({
    url: `${prefix}/router/bind`,
    method: 'POST',
    data: map,
  })
}

// 解绑权限到路由
export function unbindPermission(map) {
  return request({
    url: `${prefix}/router/unbind`,
    method: 'DELETE',
    data: map,
  })
}
